//======================================================================================
//  Apache License, Version 2.0
//  Notes:Use this command to anonymously check out the latest project source code:
//  Non-members may check out a read-only working copy anonymously over HTTP.
//  SVN checkout http://YHHLineCommandWsp.googlecode.com/svn/trunk/ 
//
//  Author:		Kevin Yang
//  Email:		Bigearrabbit@qq.com
//
//  DATE:		2013-4-6
//
//  File Name:	YHHELineCommandChild.cpp
//
//  Notes:
//  Provide implementation to interface
//      YHHILineCommand
//======================================================================================

// Local Framework
#include "YHHELineCommandChild.h"

// ObjectSpecsModeler
#include "CATIDescendants.h"

// MecModInterfaces Framework
#include "CATIMfBRep.h"

// ObjectSpecsModeler Framework
#include "CATISpecObject.h"     // needed to manage/query features
#include "CATISpecAttrAccess.h" // needed to access feature attributes
#include "CATISpecAttrKey.h"    // needed to access to the feature attribute values

CATImplementClass ( YHHELineCommandChild ,
                   DataExtension       ,    
                   CATBaseUnknown      ,
                   YHHLineCommandChild        );

//-------------------------------------------------------------------------------------
// YHHELineCommandChild : constructor
//-------------------------------------------------------------------------------------
YHHELineCommandChild::YHHELineCommandChild():
CATBaseUnknown()
{
    
}

//-------------------------------------------------------------------------------------
// YHHELineCommandChild : destructor
//-------------------------------------------------------------------------------------
YHHELineCommandChild::~YHHELineCommandChild()
{
    
}

// Tie the implementation to its interface
// ---------------------------------------

// To declare that YHHLineCommandChild implements YHHILineCommand, insert 
// the following line in the interface dictionary:
//
// YHHLineCommandChild  YHHILineCommand  libYHHLineCommandChild

#include "TIE_YHHILineCommandChild.h" // needed to tie the implementation to its interface
TIE_YHHILineCommandChild( YHHELineCommandChild);

//-----------------------------------------------------------------------------
HRESULT YHHELineCommandChild::GetParams(YHHLineCommandChildParam & oValue)const
{
	//DO NOT EDIT IN THE CONTROL CODE OF "KEVIN CAA WIZARD SECTION"
	//START KEVIN CAA WIZARD SECTION YHHLineCommandChild IMPLEMENTS PARAM GET

	oValue.StartPoint = this->GetStartPoint();//1
	oValue.LineDirection = this->GetLineDirection();//2
	oValue.LengthSign = this->GetLengthSign();//3
	oValue.LengthStart = this->GetLengthStart();//4
	oValue.LengthEnd = this->GetLengthEnd();//5
	//END KEVIN CAA WIZARD SECTION YHHLineCommandChild IMPLEMENTS PARAM GET
	return S_OK;//ok
}
//-----------------------------------------------------------------------------
HRESULT YHHELineCommandChild::SetParams(const YHHLineCommandChildParam & iValue)
{
	HRESULT hr = S_OK;//default ok
	//DO NOT EDIT IN THE CONTROL CODE OF "KEVIN CAA WIZARD SECTION"
	//START KEVIN CAA WIZARD SECTION YHHLineCommandChild IMPLEMENTS PARAM SET

	CATUnicodeString ErrMSG1="Find Error:";
	CATBoolean IsFindError=FALSE;

	hr=this->SetStartPoint(iValue.StartPoint);//1
	if (FAILED(hr)){
		ErrMSG1.Append("\nSet Parameter of StartPoint Error!");
		IsFindError=TRUE;
	}
	hr=this->SetLineDirection(iValue.LineDirection);//2
	if (FAILED(hr)){
		ErrMSG1.Append("\nSet Parameter of LineDirection Error!");
		IsFindError=TRUE;
	}
	hr=this->SetLengthSign(iValue.LengthSign);//3
	if (FAILED(hr)){
		ErrMSG1.Append("\nSet Parameter of LengthSign Error!");
		IsFindError=TRUE;
	}
	hr=this->SetLengthStart(iValue.LengthStart);//4
	if (FAILED(hr)){
		ErrMSG1.Append("\nSet Parameter of LengthStart Error!");
		IsFindError=TRUE;
	}
	hr=this->SetLengthEnd(iValue.LengthEnd);//5
	if (FAILED(hr)){
		ErrMSG1.Append("\nSet Parameter of LengthEnd Error!");
		IsFindError=TRUE;
	}
	if (IsFindError){
		this->SetErrMsg (ErrMSG1);
		return E_FAIL;
	}
	//END KEVIN CAA WIZARD SECTION YHHLineCommandChild IMPLEMENTS PARAM SET
	return S_OK;//ok
}
//-----------------------------------------------------------------------------

//DO NOT EDIT IN THE CONTROL CODE OF "KEVIN CAA WIZARD SECTION"
//START KEVIN CAA WIZARD SECTION YHHLineCommandChild IMPLEMENTS CPP GET

//-----------------------------------------------------------------------------
CATUnicodeString YHHELineCommandChild::GetErrMsg() const//0
{
	CATUnicodeString oValue("");
	m_YHHSpecRW.GetValue("ErrMsg",oValue);
	return oValue;
}
//-----------------------------------------------------------------------------
CATISpecObject_var YHHELineCommandChild::GetStartPoint() const//1
{
	CATISpecObject_var oValue(NULL_var);
	m_YHHSpecRW.GetSpecValue("StartPoint",oValue);
	return oValue;
}
//-----------------------------------------------------------------------------
CATISpecObject_var YHHELineCommandChild::GetLineDirection() const//2
{
	CATISpecObject_var oValue(NULL_var);
	m_YHHSpecRW.GetSpecValue("LineDirection",oValue);
	return oValue;
}
//-----------------------------------------------------------------------------
int YHHELineCommandChild::GetLengthSign() const//3
{
	int oValue(1);
	m_YHHSpecRW.GetValue("LengthSign",oValue);
	return oValue;
}
//-----------------------------------------------------------------------------
double YHHELineCommandChild::GetLengthStart() const//4
{
	double oValue(0);
	m_YHHSpecRW.GetValue("LengthStart",oValue);
	return oValue;
}
//-----------------------------------------------------------------------------
double YHHELineCommandChild::GetLengthEnd() const//5
{
	double oValue(5.0/1000.0);
	m_YHHSpecRW.GetValue("LengthEnd",oValue);
	return oValue;
}
//END KEVIN CAA WIZARD SECTION YHHLineCommandChild IMPLEMENTS CPP GET

//DO NOT EDIT IN THE CONTROL CODE OF "KEVIN CAA WIZARD SECTION"
//START KEVIN CAA WIZARD SECTION YHHLineCommandChild IMPLEMENTS CPP SET

//-----------------------------------------------------------------------------
HRESULT YHHELineCommandChild::SetErrMsg(const CATUnicodeString & iValue)//0
{
	return m_YHHSpecRW.SetValue("ErrMsg",iValue);
}
//-----------------------------------------------------------------------------
HRESULT YHHELineCommandChild::SetStartPoint(const CATISpecObject_var & iValue)//1
{
	return m_YHHSpecRW.SetSpecValue("StartPoint",iValue);
}
//-----------------------------------------------------------------------------
HRESULT YHHELineCommandChild::SetLineDirection(const CATISpecObject_var & iValue)//2
{
	return m_YHHSpecRW.SetSpecValue("LineDirection",iValue);
}
//-----------------------------------------------------------------------------
HRESULT YHHELineCommandChild::SetLengthSign(const int & iValue)//3
{
	return m_YHHSpecRW.SetValue("LengthSign",iValue);
}
//-----------------------------------------------------------------------------
HRESULT YHHELineCommandChild::SetLengthStart(const double & iValue)//4
{
	return m_YHHSpecRW.SetValue("LengthStart",iValue);
}
//-----------------------------------------------------------------------------
HRESULT YHHELineCommandChild::SetLengthEnd(const double & iValue)//5
{
	return m_YHHSpecRW.SetValue("LengthEnd",iValue);
}
//END KEVIN CAA WIZARD SECTION YHHLineCommandChild IMPLEMENTS CPP SET
